#ifndef MONITORINGDEVICETABLEMODEL_H
#define MONITORINGDEVICETABLEMODEL_H

#include <QAbstractTableModel>
#include <QList>
#include "deviceModel.h"
class MonitoringDeviceTableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    MonitoringDeviceTableModel(QObject *parent = nullptr);
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
     int columnCount(const QModelIndex &parent = QModelIndex()) const override;
     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
      QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
       void setDeviceList(const QList<deviceModel> &list);
       QList<deviceModel> getDeviceList() const;
       void removeDevice(int row) ;

       void updateAllDeviceList(const QList<deviceModel> &newList);

       Qt::ItemFlags flags(const QModelIndex &index) const override;
       void setEditRow(int row);
       void updateDeviceData(int row, int column, const QVariant &newData);
       bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
signals:
    void deviceDelete(const deviceModel& device);
private:
    QList<deviceModel> deviceList;
    int editRow = -1;


};

#endif // MONITORINGDEVICETABLEMODEL_H
